package com.jiyinit.web.core.video.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.jiyinit.core.framework.base.paging.PagingResult;
import com.jiyinit.web.core.video.dao.TabCoreVideoDao;
import com.jiyinit.web.core.video.dto.VideoRequest;
import com.jiyinit.web.core.video.entity.TabCoreVideoEntity;

@Service("core.videoServiceImpl")
public class VideoServiceImpl {
	
	@Resource(name = "core.tabCoreVideoDao")
	private TabCoreVideoDao tabCoreVideoDao;
	
	
	/**
     * 多条件分页查询
     * @param request
     * @return
     */
	public PagingResult<TabCoreVideoEntity> findForPage(VideoRequest request){
        return tabCoreVideoDao.findForPage(request);
    }
	
	/**
	 * id查询
     * @param id
     * @return
     */
	public TabCoreVideoEntity findOne(Integer id){
		return tabCoreVideoDao.findOne(id);
	}
	
	/**
	 * 添加
     * @param entity
     * @return
     */
	public int add(TabCoreVideoEntity entity){
		return tabCoreVideoDao.add(entity);
	}
	
	/**
	 * 修改
     * @param entity
     * @return
     */
	public int update(TabCoreVideoEntity entity){
		return tabCoreVideoDao.update(entity);
	}

	public List<TabCoreVideoEntity> findVlistByUserId(Integer userId){
		return tabCoreVideoDao.findVlistByUserId(userId);
	}
	
	/**
	 * 删除
     * @param id
     * @return
     */
	public int delete(Integer id){
		return tabCoreVideoDao.delete(id);
	}

	/**
	 * 多条件单体查询
	 * @param obj
	 * @return
     */
	public TabCoreVideoEntity findOneBySelective(TabCoreVideoEntity obj){
		return tabCoreVideoDao.findOneBySelective(obj);
	}

	/**
	 * 查询当前用户开启的房间
	 * @param userId
	 * @return
	 */
	public List<TabCoreVideoEntity> findOpenRoom(Integer userId){
		return tabCoreVideoDao.findOpenRoom(userId);
	}

	public PagingResult<TabCoreVideoEntity> findVideoListByUserId(VideoRequest request){
		return tabCoreVideoDao.findVideoListByUserId(request);
	}
}